package day01;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

/**
 * @Author Stringzhua
 * @Date 2024/10/28 14:50
 * description:
 */
public class Test02 {
    public static void main(String[] args) {
        //打印JVM进程中的所有线程
        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        ThreadInfo[] threadInfoArray = threadMXBean.dumpAllThreads(true, true);
        for (ThreadInfo threadInfo : threadInfoArray) {
            System.out.println(threadInfo.getThreadName());
        }
    }
}
